package com.example.demo.util;


import com.example.demo.entity.Result;

public class ResultUtil {

    public static Result success(Object object){
        Result result = new Result();
        result.setCode(ResultEnum.SUCCESS.getCode());
        result.setMsg(ResultEnum.SUCCESS.getMsg());
        result.setData(object);
        return result;
    }




    public static Result success(){
        Result result = new Result();
        result.setCode(0);
        result.setMsg("成功");
        return result;
    }

    public static Result error(Integer code, String message){
        Result result= new Result();
        result.setMsg(message);
        result.setCode(code);
        return result;
    }


    public static ResultTwo success(Object object,Object rightObject){
        ResultTwo result = new ResultTwo();
        result.setCode(ResultEnum.SUCCESS.getCode());
        result.setMsg(ResultEnum.SUCCESS.getMsg());
        result.setData(object);
        result.setRightData(rightObject);
        return result;
    }
}
